/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Fenetre;

import Fenetre.BoutonListener.ButtonListenerException;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Simon
 */
public class FenetreException extends JFrame {
    
    private Exception exception;

    public FenetreException(Exception exception) {
        
        this.exception = exception;
        this.setSize(400, 400);
        this.setTitle("Erreur");
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setAlwaysOnTop(true);
        
        JPanel panel = new JPanel();
        BoxLayout layout = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
        panel.setLayout(layout);
        
        panel.add(new JLabel(exception.getMessage()));
        JButton bouton = new JButton("Ok");
        bouton.addActionListener(new ButtonListenerException(this));
        panel.add(bouton);
        
        this.setVisible(true);
    }
    
    
    
}
